<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>实验室预约</title>
<style type="text/css">
body{
font-size:28px;
margin:0;
padding:0;
}
.mainLayout{
width:100%;
background-color: #EEEEEE;
height: 480px;
margin-top: 3px;
}
.titleLayout{
text-align:left;
height: 40px;
line-height: 40px;
width:100%;
}
.twoDiv{
 text-align: left;
}
.must{
color:red;
}
</style>
</head>
<body>
<div class="mainLayout" >
<div  class="titleLayout" >
 <span>预约日期:${appointDay}</span><span style="margin-left: 50px;">实验室:${lab.name}</span>
 <span style="margin-left: 50px;">课节:${lesson}</span>
</div>
<form id="form1">
<input type="hidden" name="appointDay" value="${appointDay}"/>
<input type="hidden" name="openRecordId" value="${openRecord.id}"/>
<div class="twoDiv" style="margin-top: 20px;">
<span class="must">*</span>实验类型:&nbsp;<t:CommonSelect url="dictTestTypeController.do?select"  name="testTypeName" textField="testTypeName" idField="id"></t:CommonSelect>&nbsp;&nbsp;
<span class="must">*</span>座位信息:<input type="text" name="seat" id="seat"/>
		<a class="easyui-linkbutton" icon="icon-search"  onclick="selectSeats('${lab.id}','${openRecord.id}')">自选</a>
</div>
<div class="twoDiv"  style="margin-top: 20px;">
<label class="Validform_label"><span class="must">*</span>实验项目:</label>
<input id="teachItemId" name="teachItemId" type="hidden" >               
<input id="itemName" name="itemName" style="width:350px;"  type="text" style="width: 150px" class="inputxt"  readonly="readonly"  >
<t:choose hiddenName="teachItemId" hiddenid="id" url="dictTeachItemController.do?goSelect" name="groupList" icon="icon-search" title="选择" textname="itemName" isclear="false" isInit="true"  ></t:choose> 
<span class="Validform_checktip"></span>
<label class="Validform_label" style="display: none;">实验项目</label>
</div>

<div style="margin-top: 20px;" >
<div class="Validform_label" style="float:left;margin-top: 40px"><span class="must">*</span>实验内容:&nbsp;</div><textarea rows="8" cols="66" name="testDesc" id="testDesc"></textarea>
</div>

<div>
<label class="Validform_label">
		<span class="must">*</span>指导教师:
</label>
      <input id="coacherId" name="coacherId" type="hidden"  >               
     <input id="coacherName" name="coacherName" type="text" style="width:360px;" class="inputxt" 
      readonly="readonly"   >
     <t:choose hiddenName="coacherId" hiddenid="id" url="teacherController.do?goSelect" name="teacherList"
                     icon="icon-search" title="选择" textname="realName"  inputTextname="coacherName" isclear="false" isInit="true"  ></t:choose>
		
	<span class="Validform_checktip"></span>
	<label class="Validform_label" style="display: none;">辅导教师</label>

</div>

<div>
<label class="Validform_label">
	小组成员:
</label>
<input id="member" name="member" type="text" style="width:420px;" >
</div>
</form>

</div>

</body>
<script type="text/javascript">
function selectSeats(id,openRecordId){
	  var addurl = 'labAppointApplyController.do?selectOpenSeats&id='+id+"&openRecordId="+openRecordId;
	  var parent = frameElement.api;
	  $.dialog({
		  	id:'selectSeatsDialog1',
			content: 'url:'+addurl,
			lock : true,
			zIndex: 9999, 
			width:900,
			height:500,
			title:'选择座位 ', 
			opacity : 0.3,
			cache:false,
		    cancelVal: '关闭',
		    cancel: true,
		    parent:parent,
 		    ok: function(){
 		    	iframe = this.iframe.contentWindow;
 		    	var seates = iframe.getSelectSeat();
 		    	if(seates == null || seates == 'null') return false;
 		    	$("#seat").val(seates);
 		    },
		});
	 

}

var returnMsg = "";

function saveForm(){
	var result = "false";
	if(validateForm()){
	 $.ajax({
		 datatype:'json',
       cache: true,
       type: "POST",
       url:'labAppointApplyController.do?addAppoint',
       data:$('#form1').serialize(),// 你的formid
       async: false,
       error: function(request) {
           alert("Connection error");
       },
       success: function(data) {
      	 data = $.parseJSON(data);
      	 var message = data.msg;
      	 result = message;
       }
   });
	 return result;
	}else{
		return "false";
	}
}

function validateForm(){
	var seat = $("#seat").val();
	var itemName = $("#itemName").val();
	var testDesc = $("#testDesc").val();
	var coacherName = $("#coacherName").val();
	if(seat == null || seat == "" ){
		tip("请选择预约的座位");
		return false;
	}else if(itemName == null || itemName ==""){
		tip("请选择实验项目");
		return false;
	}else if(testDesc == null || testDesc =="" ){
		tip("请填写实验内容");
		return false;
	}else if(coacherName == null || coacherName==""){
		tip("请选择指导老师");
		return false;
	}else {
		return true;
	}
}

</script>
</html>